﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace licai
{
    public partial class AddItems : Form
    {
        public AddItems()
        {
            InitializeComponent();
        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void txtName_TextChanged(object sender, EventArgs e)
        {

        }

        private void btnPreview_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == string.Empty)
            {
                MessageBox.Show("请填写收支项目名称!", "信息不完整", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
                tabControl1.SelectedTab = tabPage2;
            }

        private void rdoExpense_CheckedChanged(object sender, EventArgs e)
        {
            cboKind.Items.Clear();
            cboKind.Items.Add("一级大类");
            if (rdoExpense.Checked == true)
            {
                cboKind.Items.Add("生活消费");
                cboKind.Items.Add("固定资产");
                cboKind.Items.Add("娱乐活动");
                cboKind.Items.Add("医疗生活");
                cboKind.Items.Add("教育培训");
                cboKind.Items.Add("其他活动");
            }
            else {
                cboKind.Items.Add("工作收入");
                cboKind.Items.Add("投资收入");
                cboKind.Items.Add("其他收入");
            }
            cboKind.SelectedIndex = 0;
        }

        private void tabPage1_Click(object sender, EventArgs e)
        {

        }

        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 1)
            {
                if (txtName.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("请填写收支项目名称", "信息不完整", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    rtxtMsg.Clear();
                    rtxtMsg.AppendText("要添加的收支项目为:");
                    rtxtMsg.AppendText("txtName.Text");
                    rtxtMsg.AppendText("\n所属类别:"+cboKind .SelectedItem .ToString ());
                    if (rdoExpense.Checked == true) rtxtMsg.AppendText("\n是支出类型的项目");
                    else rtxtMsg.AppendText("\n是收入类型的项目");

                }
            }
        }

   
    }
}
